package com.example.demo.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.dao.IUserMapper;
import com.example.demo.entity.IUser;
import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import com.example.demo.service.UserService;

/**
 * @author CJunGod 1038804380@qq.com
 *
 */
@Service
@Transactional
public class UserServiceImpl implements UserService{
	
	@Resource
	private UserMapper userMapper;
	
	@Resource
	private IUserMapper iUserMapper;

	@Override
	public User selectByUser(String userName) {
		
		return userMapper.findByUserName(userName);
	}

	@Override
	public IUser findUser(String userName) {
		
		return iUserMapper.findByUserName(userName);
	}

	@Override
	public boolean saveIUser(String userName, String password) {
		boolean flag = iUserMapper.insertIUser(userName, password);
		boolean fg = userMapper.insertUser(userName, password);
//		int j = 1 / 0; 
		return flag&&fg?true:false;
	}

}
